#!/usr/bin/env python
# coding: utf-8
import sys
sys.path.append('./Lib/')
from File_Operation import *
from List_Operation import *
from MG_Operation import *

# ## 执行参数替换
np.set_printoptions(threshold=np.inf)
pd.set_option('display.max_columns',None)
pd.set_option('display.max_rows',None)





#设置基本替换文件
# 定义变量
source = '../input_data/card/param_card.dat'
replaced_content={"tb":"    1 scan1: {} # TB",
	              "sba" :"    2 scan1: {} # sinbma",
		          "mh"  :"   25 scan1: {} # mh1",
			      "mH"  :"   35 scan1: {} # mh2",
				  "mA"  :"   36 scan1: {} # mh3",
				  "mch" :"   37 scan1: {} # mhc"}

node_num=3
file_name="sba_tb"
df = pd.read_table("../input_data/data/data_grid_{}.tsv".format(file_name))
input_value_list=Get_Maplist_Key(replaced_content)


input_dict={}
for key in input_value_list: 
	data_list=df[key].to_list()
	split_list = Split_List_n_List(data_list, node_num)
	output_string=[", ".join(map(str,alist)) for alist in split_list]
	output_string=["["+content+"]" for content in output_string]
	input_dict[key]=output_string

# 将key单独提取为列表
com_file_name='../output_data/scan_param/param_card_{}.dat'
Generate_MG_Scan_ParamCard(input_dict,source,replaced_content,node_num, com_file_name)
